// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()
const db = cloud.database()
// 云函数入口函数
exports.main = async (event, context) => {
  // var name = event.name
  // var img = event.img
  // var openid = event.openid
  try {
    
    return await db.collection('user').add({
      data:{
        gooduser:event.user,
        userimg:event.userimg,
        fabuuser:event._openid,
        tieziid:event._id,
        message:event.message
      }
    })
  } catch (e) {
    console.log(e)
  }
}